{include file="common/header"/}

<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body">
                    <form class="layui-form layui-form-pane" lay-filter="form">
                        <input type="hidden" name="id"  >
                        <div class="layui-form-item">
                            <label class="layui-form-label">头像</label>
                            <input type="hidden" name="avatar" id="avatar" class="attach">
                            <div class="layui-input-inline">
                                <div class="layui-upload">
                                    <button type="button" class="layui-btn layui-btn-primary" data-path='user' id="selectAttach" data-href="{:url('sys.attach/select')}?mime=image"><i class="icon icon-upload3"></i>点击上传</button>
                                    <div class="layui-upload-list">
                                        <img class="layui-upload-img" width="120" height="80" id="addPic">
                                        <p id="notice"></p>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">所属等级</label>
                            <div class="layui-input-inline">
                                <select name="level_id" lay-verify="required">
                                    <option value="">请选择等级</option>
                                    {volist name="userLevel" id="vo"}
                                    <option value="{$vo.id}" {if !empty($info) && $info.level_id==$vo.id} selected {/if} >{$vo.level_name}</option>
                                    {/volist}
                                </select>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">用户名</label>
                            <div class="layui-input-inline">
                                <input type="text" name="username" lay-verify="required" {if  $info && $info.id!==1}readonly="readonly"{/if} placeholder="{:lang('pleaseEnter')}用户名" class="layui-input {if $info && $info.id!==1}layui-disabled{/if}">
                            </div>
                            <div class="layui-form-mid layui-word-aux">
                                在4到25个字符之间。
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">{:lang('password')}</label>
                            <div class="layui-input-inline">
                                <input type="password" name="password" placeholder="{:lang('pleaseEnter')}登录密码" autocomplete="true" {if empty($info)} lay-verify="required"{/if} class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux">
                                密码必须大于6位，小于15位。
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">手机</label>
                            <div class="layui-input-inline">
                                <input type="text" name="mobile" placeholder="{:lang('pleaseEnter')}手机" class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux">
                                必须是正确的手机号
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">{:lang('email')}</label>
                            <div class="layui-input-inline">
                                <input type="text" name="email" placeholder="{:lang('pleaseEnter')}邮箱" class="layui-input">
                            </div>

                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">{:lang('sex')}</label>
                            <div class="layui-input-block">
                                    <input type="radio" name="sex" lay-filter="sex" checked value="1" title="男">
                                    <input type="radio" name="sex" lay-filter="sex" value="2" title="女">
                                    <input type="radio" name="sex" lay-filter="sex" value="0" title="保密">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block">

                                <button type="button" class="layui-btn" lay-submit="" lay-filter="submit">{:lang('submit')}</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
        
    </div>
</div>

{include file="common/footer"/}
<script>
    layui.use(['form','laydate','upload'], function () {
        var form = layui.form, laydate=layui.laydate,upload = layui.upload;
        var info = '';
        //日期范围
        laydate.render({
            elem: '#date'
            ,range: true
        });

        info = {:json_encode($info)};
        form.val("form", info);
        if(info){
            $('#addPic').attr('src',info.avatar);
        }
        form.render();

    });
</script>